package io.renren.modules.sys.service.impl;

import com.baomidou.mybatisplus.mapper.Wrapper;
import io.renren.common.annotation.DataFilter;
import io.renren.common.utils.Constant;
import io.renren.modules.sys.entity.InfoManagerEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;

import io.renren.modules.sys.dao.CustominfoDao;
import io.renren.modules.sys.entity.CustominfoEntity;
import io.renren.modules.sys.service.CustominfoService;


@Service("custominfoService")
public class CustominfoServiceImpl extends ServiceImpl<CustominfoDao, CustominfoEntity> implements CustominfoService {
    @Autowired
    private CustominfoServiceImpl CustominfoService;
    @Override
    @DataFilter(subDept = true, user = false)
    public PageUtils queryPage(Map<String, Object> params) {
        Page<CustominfoEntity> page = this.selectPage(
                new Query<CustominfoEntity>(params).getPage(),
                new EntityWrapper<CustominfoEntity>().addFilterIfNeed(params.get(Constant.SQL_FILTER) != null, (String)params.get(Constant.SQL_FILTER))
        );
        int countUtil = 0 ;
        Wrapper<CustominfoEntity> wrapperUtil = new EntityWrapper<>();
        countUtil = CustominfoService.selectCount(wrapperUtil.addFilterIfNeed(params.get(Constant.SQL_FILTER) != null, (String)params.get(Constant.SQL_FILTER)));
        page.setTotal(countUtil);
        return new PageUtils(page);
    }

}
